<?php
/**
 * Created by PhpStorm.
 * BuyUser: Jhu
 * Date: 16/12/20
 * Time: 下午4:49
 */
namespace common\widgets;

class RecordComment {

    public static function getRecordStudentDes($process)
    {
        switch ($process['performance'])
        {
            case 0 :
                $performance = '暂无';
                break;
            case 1 :
                $performance = '很差';
                break;
            case 2 :
                $performance = '一般';
                break;
            case 3 :
                $performance = '尚可';
                break;
            case 4 :
                $performance = '较好';
                break;
            case 5 :
                $performance = '很好';
                break;
            default :
                $performance = '很好';
                break;
        }

        switch ($process['note_accuracy'])
        {
            case 0 :
                $note_accuracy = '暂无';
                break;
            case 1 :
                $note_accuracy = '很差';
                break;
            case 2 :
                $note_accuracy = '一般';
                break;
            case 3 :
                $note_accuracy = '尚可';
                break;
            case 4 :
                $note_accuracy = '较好';
                break;
            case 5 :
                $note_accuracy = '很好';
                break;
            default :
                $note_accuracy = '很好';
                break;
        }

        switch ($process['rhythm_accuracy'])
        {
            case 0 :
                $rhythm_accuracy = '暂无';
                break;
            case 1 :
                $rhythm_accuracy = '很差';
                break;
            case 2 :
                $rhythm_accuracy = '一般';
                break;
            case 3 :
                $rhythm_accuracy = '尚可';
                break;
            case 4 :
                $rhythm_accuracy = '较好';
                break;
            case 5 :
                $rhythm_accuracy = '很好';
                break;
            default :
                $rhythm_accuracy = '很好';
                break;
        }

        switch ($process['coherence'])
        {
            case 0 :
                $coherence = '暂无';
                break;
            case 1 :
                $coherence = '很差';
                break;
            case 2 :
                $coherence = '一般';
                break;
            case 3 :
                $coherence = '尚可';
                break;
            case 4 :
                $coherence = '较好';
                break;
            case 5 :
                $coherence = '很好';
                break;
            default :
                $coherence = '很好';
                break;
        }

        return [$performance, $note_accuracy, $rhythm_accuracy, $coherence];
    }

    public static function getRecordPerformanceDes($process)
    {
        $performance_arr = $note_accuracy_arr =  $rhythm_accuracy_arr = $coherence_arr = [];
        $performance_arr['ori'] = $process['performance'];
        $note_accuracy_arr['ori'] = $process['note_accuracy'];
        $rhythm_accuracy_arr['ori'] = $process['rhythm_accuracy'];
        $coherence_arr['ori'] = $process['coherence'];

        switch ($process['performance'])
        {
            case 0 :
                $performance_arr['des'] = '暂无';
                $performance_arr['pro'] = 0;
                break;
            case 1 :
                $performance_arr['des'] = '很差';
                $performance_arr['pro'] = 1;
                break;
            case 2 :
                $performance_arr['des'] = '一般';
                $performance_arr['pro'] = 2;
                break;
            case 3 :
                $performance_arr['des'] = '尚可';
                $performance_arr['pro'] = 3;
                break;
            case 4 :
                $performance_arr['des'] = '较好';
                $performance_arr['pro'] = 4;
                break;
            case 5 :
                $performance_arr['des'] = '很好';
                $performance_arr['pro'] = 5;
                break;
            default :
                $performance_arr['des'] = '很好';
                $performance_arr['pro'] = 5;
                break;
        }

        switch ($process['note_accuracy'])
        {
            case 0 :
                $note_accuracy_arr['des'] = '暂无';
                $note_accuracy_arr['pro'] = 0;
                break;
            case 1 :
                $note_accuracy_arr['des'] = '很差';
                $note_accuracy_arr['pro'] = 1;
                break;
            case 2 :
                $note_accuracy_arr['des'] = '一般';
                $note_accuracy_arr['pro'] = 2;
                break;
            case 3 :
                $note_accuracy_arr['des'] = '尚可';
                $note_accuracy_arr['pro'] = 3;
                break;
            case 4 :
                $note_accuracy_arr['des'] = '较好';
                $note_accuracy_arr['pro'] = 4;
                break;
            case 5 :
                $note_accuracy_arr['des'] = '很好';
                $note_accuracy_arr['pro'] = 5;
                break;
            default :
                $note_accuracy_arr['des'] = '很好';
                $note_accuracy_arr['pro'] = 5;
                break;
        }

        switch ($process['rhythm_accuracy'])
        {
            case 0 :
                $rhythm_accuracy_arr['des'] = '暂无';
                $rhythm_accuracy_arr['pro'] = 0;
                break;
            case 1 :
                $rhythm_accuracy_arr['des'] = '很差';
                $rhythm_accuracy_arr['pro'] = 1;
                break;
            case 2 :
                $rhythm_accuracy_arr['des'] = '一般';
                $rhythm_accuracy_arr['pro'] = 2;
                break;
            case 3 :
                $rhythm_accuracy_arr['des'] = '尚可';
                $rhythm_accuracy_arr['pro'] = 3;
                break;
            case 4 :
                $rhythm_accuracy_arr['des'] = '较好';
                $rhythm_accuracy_arr['pro'] = 4;
                break;
            case 5 :
                $rhythm_accuracy_arr['des'] = '很好';
                $rhythm_accuracy_arr['pro'] = 5;
                break;
            default :
                $rhythm_accuracy_arr['des'] = '很好';
                $rhythm_accuracy_arr['pro'] = 5;
                break;
        }

        switch ($process['coherence'])
        {
            case 0 :
                $coherence_arr['des'] = '暂无';
                $coherence_arr['pro'] = 0;
                break;
            case 1 :
                $coherence_arr['des'] = '很差';
                $coherence_arr['pro'] = 1;
                break;
            case 2 :
                $coherence_arr['des'] = '一般';
                $coherence_arr['pro'] = 2;
                break;
            case 3 :
                $coherence_arr['des'] = '尚可';
                $coherence_arr['pro'] = 3;
                break;
            case 4 :
                $coherence_arr['des'] = '较好';
                $coherence_arr['pro'] = 4;
                break;
            case 5 :
                $coherence_arr['des'] = '很好';
                $coherence_arr['pro'] = 5;
                break;
            default :
                $coherence_arr['des'] = '很好';
                $coherence_arr['pro'] = 5;
                break;
        }
        //等级
        $total_score = max(0,$process['total_score']);
        if($total_score >100){
            $grade = 'S';
            $grade_name = '演奏大师';
        }elseif($total_score >= 90){
            $grade = 'S';
            $grade_name = '演奏大师';
        }elseif($total_score >= 80){
            $grade = 'A';
            $grade_name = '首席乐手';
        }elseif($total_score >= 70){
            $grade = 'B';
            $grade_name = '高级乐手';
        }elseif($total_score >= 50){
            $grade = 'C';
            $grade_name = '中级乐手';
        }elseif($total_score >= 0){
            $grade = 'D';
            $grade_name = '初级乐手';
        }
        return [
            'grade'=>$grade,
            'grade_name'=>$grade_name,
            'total_score'=>$total_score,
            'list'=>[
                'performance'=>$performance_arr,
                'note_accuracy'=>$note_accuracy_arr,
                'rhythm_accuracy'=>$rhythm_accuracy_arr,
                'coherence'=>$coherence_arr,
            ]
        ];


    }
}
